{extend name="public:layerbase" /}

{block name="style"}

<style type="text/css">
    .details{padding: 15px 10px 20px;}
    .details li{padding-top: 5px;width: 50%;float: left;}
    .details li img{height: 98px;border: 1px solid #5e5d5d}
    .details li span{display: block;float: left;width: 120px;line-height: 30px;text-align: right;}
    .details li p{display: block;float: left;line-height: 30px;margin-left: 5px}
    .details li input{display: block;float: left;width: 150px;height: 28px;line-height: 28px;border: 1px solid #90988a;}
    .details .proof{padding-top: 15px;}
    .details .proof p{font-size: 18px;line-height: 30px;text-align: center;color: red;}
    .details .but{width: 180px; margin: 0px auto;padding-top: 10px;}
</style>

{/block}

{block name="content"}
<div class="details">
    <li>
        <span>订单编号：</span>
        <p>{$Arr.order_sn}</p>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>订单状态：</span>
        <p style="color: #ff7d23">{$Arr.statusName}</p>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>商品图片：</span>
        <a target="_blank" href='{:url("Goods/add",array("id"=>$Arr["goods_id"]))}'>
            <img src="{$Arr.goods_image}">
        </a>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>支付方式</span>
        <p style="color: #ff7d23">{$Arr.pay_name}</p>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>商品名：</span>
        <p>{$Arr.goods_name}</p>
        <div style="clear: both"></div>
    </li>
    {if condition="$Arr.pay_id eq 3"}
        <li>
        <span>支付凭证：</span>
        </br>
        <a>
            <img src="{$Arr.proof}">
        </a>
        <div style="clear: both"></div>
    </li>
    {/if}
    <li>
        <span>商品价格：</span>
        <p style="color: red">{$Arr.goods_price}（元）</p>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>购买数量：</span>
        <p>{$Arr.num}</p>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>支付佣金：</span>
        <p>{$Arr.amount}</p>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>购买时间：</span>
        <p>{$Arr.add_time|date="y-m-d H:i",###}</p>
        <div style="clear: both"></div>
    </li>
    <li>
        <span>支付时间：</span>
        {if condition="$Arr.pay_time eq 0"}
        <p style="color: #1E9FFF">待发货</p>
        {else/}
        <p>{$Arr.pay_time|date="y-m-d H:i",###}</p>
        {/if}
        <div style="clear: both"></div>
    </li>
    <li style="width: 100%">
        <span>备注：</span>
        <p>{$Arr.remark}</p>
        <div style="clear: both"></div>
    </li>
    {if condition="$Arr.pay_id eq 3"}
    <li style="width: 100%">
        <a class="layui-btn layui-btn-mini" href="javascript:pay({$Arr.id});">确认已支付</a>
    </li>
    {/if}
</div>

{/block}

{block name="javascript"}
<script type="text/javascript">

    function pay(id){
        layer.confirm('确定已线下付款吗？不可更改！', function(index){
            $.ajax({
                type: 'POST',
                url: '{:url("Order/pay")}',
                dataType: 'json',
                data: {id: id},
                success: function (data) {
                    layer.close(index);
                    if( data.result != 0 ){

                        layer.open({
                            content: data.msg//
                            ,yes: function(index, layero){
                                layer.close(index);
                            }
                        });
                    }else{

                        layer.open({
                            content: data.msg//
                            ,yes: function(index, layero){
                                var tk = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(tk);
                                layer.close(index);
                            }
                            ,cancel:function(index){
                                var tk = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(tk);
                                layer.close(index);
                            }
                        });
                    }
                }
            });

        });
    }

    function order_puy(id){
        layer.confirm('确定发货吗？不可更改！', function(index){

            var express_code = $("#express_code").val();
            var express_name = $("#express_name").val();
            if( express_name == "" ){
                layer.close(index);
                prompt_From_one("请输入快递公司名");
                return false;
            }
            if( express_code == "" ){
                layer.close(index);
                prompt_From_one("请输入快递单号");
                return false;
            }

            $.ajax({
                type: 'POST',
                url: '{:url("GoodsOrder/order_fh")}',
                dataType: 'json',
                data: {id: id,express_code:express_code,express_name:express_name},
                success: function (data) {
                    layer.close(index);
                    if( data.result != 0 ){

                        layer.open({
                            content: data.msg//
                            ,yes: function(index, layero){
                                layer.close(index);
                            }
                        });
                    }else{

                        layer.open({
                            content: data.msg//
                            ,yes: function(index, layero){
                                var tk = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(tk);
                                layer.close(index);
                            }
                            ,cancel:function(index){
                                var tk = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(tk);
                                layer.close(index);
                            }
                        });
                    }
                }
            });
        });
    }
</script>

{/block}